package models;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import org.hibernate.validator.constraints.NotBlank;

import play.data.validation.Constraints.Required;
import play.db.ebean.Model;

@Entity
public class Event extends Model {

    private static final long serialVersionUID = 1L;

    @Id
    private Long id;

    @NotBlank(message = "Name cannot be blank")
    @Required(message = "A name is required")
    private String name;

    @NotBlank(message = "Description cannot be blank")
    @Required(message = "A description is required")
    private String description;

    @Required(message = "A start date is required")
    private Date startDate;

    @Required(message = "An end date is required")
    private Date endDate;

    @Required(message = "A phone is required")
    private String phone;

    @ManyToOne
    private User user;

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public static Finder<Long, Event> find = new Finder<Long, Event>(Long.class, Event.class);

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

}
